<?php
class Application_Model_Filter_CompleteSearch
{
    /**
     * 快速搜索
     */
    public $quick;
    /**
     * 任务Id
     */
    public $taskId;
    /**
     * 开始时间
     */
    public $startTime;
    /**
     * 结束时间
     */
    public $endTime;
    
    function getSearchFileds() {
        $where = array();
        $and = "";
        if($this->quick != ""){
            $userItem = Application_Model_User::getByNikeNameStore($this->quick);
            if ($userItem != null) {
                $inuserid = "(";
                foreach ($userItem as $userval) {
                    $inuserid.= $userval->id . ",";
                }
                $inuserid.= "0)";
                $where[$and . " userId in "] = $inuserid;
                $and = " and ";
            } else {
                $where[$and . " userId = "] = $this->quick;
                $and = " and ";
            }
        }
        if($this->startTime != ""){
            $where[$and." dateCreated >= "] = $this->startTime;
            $and = " and ";
        }
        if($this->endTime != ""){
            $where[$and." dateCreated <= "] = $this->endTime." 23:59:59";
            $and = " and ";
        }
        if($this->taskId != ""){
            $where[$and." taskId = "] = $this->taskId;
            $and = " and ";
        }
        return $where;
    }
}